#include <iostream>
#include <thread>
using namespace std;

void threadFunc(int x)
{
    cout << "Child id = " << this_thread::get_id() << endl;
    cout << "void threaFunc()" << endl;
    cout << "x = " << x << endl;
}

int main()
{
    cout << "Main id = " << this_thread::get_id() << endl;

    using pFunc = void (&)(int);
    // typedef void (&pFunc)(int); // pFunc 是函数引用
    pFunc f = threadFunc;

    thread th(f, 3);
    cout << "Child id = " << th.get_id() << endl;
    th.join(); // 主线程等待子线程执行结束
    return 0;
}